package priv.pront.code.robot.robCom_pri_2022;

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(sc.readLine());
        TreeSet<String> set = new TreeSet<>();
        TreeSet<String> set1 = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            set.add(sc.readLine());
        }
        int m = Integer.parseInt(sc.readLine());
        for (int i = 0; i < m; i++) {
            String s = sc.readLine();
            if (set.contains(s)){
                set.remove(s);
            }
            else{
                set1.add(s);
            }
        }


        if (set.isEmpty()){
            out.println("All Back");
        }
        else{
            out.println("Missing: "+set.size());
            for (String s : set) {
                out.println(s);
            }
        }

        if (set1.isEmpty()){
            out.println("All Known");
        }
        else{
            out.println("New: "+set1.size());
            for (String s : set1) {
                out.println(s);
            }
        }
        out.flush();
        out.close();
    }
}
